home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / serial / callback.001 / callback~ / callback / lib / dbase / cpfile.c < prev    next >
C/C++ Source or Header  |  1996-07-19  |  488b  |  27 lines

  1.  
  2. #include "dbase.p"
  3.  
  4. void cpfile(FILE *inf, FILE *outf)
  5. {
  6.     register int
  7.         ch;
  8.     unsigned
  9.         insize = 0;
  10.  
  11.     while (1)
  12.     {
  13.         ch = fgetc(inf);            /* read char */
  14.  
  15.         if (feof(inf))                /* at EOF? */
  16.             break;                /* yes.. done */
  17.  
  18.         insize++;
  19.  
  20.         if (fputc(ch, outf) != ch)             /* no.. write to outfile */
  21.             log(log_off, "File write '%c' (0x%x) failed\n", ch, ch);
  22.     }
  23.  
  24.     if (!insize)
  25.         log(log_off, "Zero bytes in file to read");
  26. }
  27.